package com.dushibao.admin.config;

import com.dushibao.admin.interceptor.LoginHandlerInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.Arrays;

@Configuration
public class LoginConfig implements WebMvcConfigurer {

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new LoginHandlerInterceptor())
                .addPathPatterns("/**")
                .excludePathPatterns(
                        "/admin/getCode",
                        "/admin/login",
                        "/admin/doLogin",
                        "/admin/register",
                        "/admin/doRegister",
                        "/assets/**",
                        "/favicon.ico"
                );

    }
}
